<template>
  <div class="gallery">
    <swiper class="gallery-swiper" :options="swiperOption">
      <swiper-slide v-for="(img, index) in galleryImgs"
        :key="index">
        <div class="img-wrapper"
          @click="hideGallery">
          <img class="gallery-img" :src="img">
        </div>
      </swiper-slide>
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>

export default {
  name: 'CommonGallery',
  props: {
    galleryImgs: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true,
        observeParents: true
      }
    }
  },
  methods: {
    hideGallery () {
      this.$emit('hideGallery')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .gallery >>> .swiper-pagination
    color #fff
  .gallery
    z-index 9
    overflow hidden
    position fixed
    left 0
    right 0
    top 0
    bottom 0
    background #000
    .gallery-swiper
      width 100%
      height 100%
      .img-wrapper
        display flex
        flex-direction column
        justify-content center
        height 100%
        .gallery-img
          width 100%
</style>
